<div class="g-upper-body">
  <%- include('search', {formatUrl}) %>
  <% if (locals.title) { %>
  <% if (locals.duplicates) { %>
    <%- include('partials/warning', {message: template('warning.duplicate', locals.duplicates, locals.parentId), formatUrl}) %>
  <% } %>
  <h1 class="headline"><%= title %></h1>
  <div class="kicker">
    <div class="attribution">
        <% if (locals.byline) { %>
          <p>
            By <span class="author"><%=locals.byline %></span>.
          </p>
        <% } %>
        <% if (locals.lastUpdatedBy || locals.byline) { %>
          <p>
            <% if (locals.lastUpdatedBy) { %>
              Last edited by <span class="author"><%= lastUpdatedBy %></span><span class="date" data-date="<%= locals.modifiedAt %>"></span>.
            <% } %>
            <% if (locals.byline) { %>
              Created <span class="date" data-date="<%= locals.createdAt %>"></span>.
            <% } %>
          </p>
        <% } %>
        <script>
          (function() {
            $('.date').each(function(i) {
              const date = $(this)
              const momentDate = moment(date.data('date'))
              if (momentDate.isValid()) {
                date.html(moment().diff(momentDate, 'years') > 1 ? ` on ${momentDate.format('MMMM D, YYYY')}` : ` ${momentDate.fromNow()}`)
                date.attr('title', momentDate.format('MMMM D, YYYY'))
              }
            })
          })()
        </script>
      </p>
    </div>

    <% if (locals.editLink) { %>
      <div class="tool">
        <a href="<%- editLink %>" id="edit-button" target="_blank">Edit<i class="fa fa-pencil" aria-hidden="true"></i></a>

      </div>
    <% } %>

  </div>
  <% } %>

</div>
